package com.example.shushiyunsst.fragment.main.transaction.bean;

import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public class TransIndexBean implements Serializable {

    //当前委托列表
    @JSONField(name = "list")
    private List<TransIndexDelegateBean> list = new ArrayList<>();

    //卖
    @JSONField(name = "sellList")
    private List<TransIndexWayBean> sellList = new ArrayList<>();

    //买
    @JSONField(name = "buyList")
    private List<TransIndexWayBean> buyList = new ArrayList<>();

    //均价
    @JSONField(name = "avgPrice")
    private double avgPrice;

    //交易开放时间
    @JSONField(name = "txStartTime")
    private long txStartTime;

    private boolean enableTransfer;

    public boolean isEnableTransfer() {
        return enableTransfer;
    }

    public void setEnableTransfer(boolean enableTransfer) {
        this.enableTransfer = enableTransfer;
    }

    public long getTxStartTime() {
        return txStartTime;
    }


    public String dateFormatStartTime(long nowTime) {
        String format = "";
        if (Math.abs(txStartTime - nowTime) > 60 * 60 * 24) {

            SimpleDateFormat sdf = new SimpleDateFormat("MM 月 dd 日 HH 时 mm 分 ss 秒", Locale.CHINA);
            format = sdf.format(txStartTime);
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat("HH 时 mm 分 ss 秒", Locale.CHINA);
            format = sdf.format(txStartTime);
        }

        return format;
    }

    public String dateFormatLeftTime(long leftTime) {
        String format = "";
        SimpleDateFormat sdf;
        if (leftTime > 60 * 60 * 24) {
            sdf = new SimpleDateFormat("MM 月 dd 日 HH 时 mm 分 ss 秒", Locale.CHINA);
        } else {
            sdf = new SimpleDateFormat("HH 时 mm 分 ss 秒", Locale.CHINA);
        }
        format = sdf.format(leftTime);

        return format;
    }

    public void setTxStartTime(long txStartTime) {
        this.txStartTime = txStartTime;
    }

    public double getAvgPrice() {
        return avgPrice;
    }

    public void setAvgPrice(double avgPrice) {
        this.avgPrice = avgPrice;
    }

    public List<TransIndexDelegateBean> getList() {
        return list;
    }

    public void setList(List<TransIndexDelegateBean> list) {
        this.list = list;
    }

    public List<TransIndexWayBean> getSellList() {
        return sellList;
    }

    public void setSellList(List<TransIndexWayBean> sellList) {
        this.sellList = sellList;
    }

    public List<TransIndexWayBean> getBuyList() {
        return buyList;
    }

    public void setBuyList(List<TransIndexWayBean> buyList) {
        this.buyList = buyList;
    }
}
